<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('setting',$postdata);
		exi('设置成功');
	}
	$footernav = array(
			array('title'=>'员工中心','icon'=>'icon-shouye','color'=>'#cc99ff','action'=>'jy_mjifee/index/','image'=>'../addons/jy_weishop/resource/images/jy_weishoparticle.png'),
			array('title'=>'分红','icon'=>'icon-caifua','color'=>'#66cc99','action'=>'jy_mjifee/commission/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
			array('title'=>'销售额','icon'=>'icon-manageorder','color'=>'#ff9933','action'=>'jy_mjifee/order/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
			array('title'=>'我的团','icon'=>'icon-paihao0','color'=>'#66cc66','action'=>'jy_mjifee/down/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
	);
	$return['item']=$this->plugin_setting('setting');
	$return['item']['footernav'] = !empty($return['item']['footernav']) ? $return['item']['footernav'] : $footernav;
	$aitip='启用后才生效！';
    if($_SESSION['isfounder']){
        $aitip.='</br>【务必】添加计划任务，否则自动种植等不正常（管理员可操作）！：
			</br>[注意]：<red>每次执行间隔时间不能低于28天（设置每月执行一次），建议凌晨0小时10分钟启动。</red>
			</br>1、计划任务：系统--云服务--计划任务;任务URL：jy_mjifee/plan/
		';
    }
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'tip','title'=>$aitip),
					array('type'=>'switch','title'=>'是否启用？','name'=>'isopen','help'=>'如果是多商户下，就是商户员工，如果是平台下，就是平台员工'),
					array('type'=>'string','title'=>'页面标题','name'=>'title'),
					//array('type'=>'switch','title'=>'是否需要审核','name'=>'isshenhe'),
					//array('type'=>'switch','title'=>'是否需要完善资料','name'=>'isinfo'),
					array('type'=>'link','from'=>'action','title'=>'商城链接','name'=>'shop_action','help'=>'队员中心的商城链接，不填则默认jy_weishop/index/！'),
					array('type'=>'string','title'=>'员工分享二维码说明','name'=>'share_help'),
					array('type'=>'string','title'=>'员工分享标题','name'=>'teamshare_title'),
					array('type'=>'string','title'=>'员工分享描述','name'=>'teamshare_desc'),
					array('type'=>'richtext','title'=>'员工须知','name'=>'team_xieyi'),
				)
			),
			array(
				'title'=>'结算设置',
				'list'=>array(
					array('type'=>'switch','title'=>'下单即可结算','name'=>'is_jiesuan','help'=>'不用等完成订单，就可以结算！'),
					array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
					array('type'=>'string','title'=>'结算额度（元）','name'=>'balance_fee'),
					array('type'=>'string','title'=>'分红打款手续费（%）','name'=>'balance_per'),
					array('name'=>'commissiontype','title'=>'佣金金额计算方式','type'=>'radio','help'=>'第一种：按商品实际成交价×百分比；第二种：按商品利润：【实际成交价-成本】×百分比；','options'=>'commissiontype'),
					array('type'=>'string','title'=>'免手续费提现区间开始金额','name'=>'balance_money_start'),
					array('type'=>'string','title'=>'免手续费提现区间结束金额','name'=>'balance_money_end','help'=>'当提现手续费金额在此区间内时,不扣除提现手续费. 结束金额 必须大于 开始金额才能生效'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，订单才能申请结算,设置0或空，订单完成就可以结算'),
					array('type'=>'text','title'=>'手续费说明','name'=>'balance_perdesc'),
				),
			),
			array(
							'title'=>'底部导航',
							'list'=>array(
								array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
							)
			),
			array(
					'title'=>'自定义文字',
					'list'=>array(
						array('type'=>'text','name'=>'agent_desc','title'=>'成为员工的条件提示','help'=>'默认是按成为预选员工指标，来显示的！'),
					)
			),
		)
	);
	$params=array('uniacid'=>$_SESSION['uniacid']);
    $orderby='level asc';
	$return['levels']=$this->getall('level',$params,array('id','title'),'id',$orderby);
	$return['jiefee_type']=array('到达等级自动解冻','推荐指定等级人数解冻','AB线指定等级人数解冻');
	$return['yesno']=array('不能','能');
	$return['daili_file']=$this->daili_file;
	$return['feeti_type']=$this->feeti_type;
	$return['team_tiaojians']=$this->team_tiaojians;
	$return['leveltype']=$this->level_up_types;
	$return['agent_types']=$this->agent_types;
	$return['withdraw']=$this->pay_types;
	$return['commissiontype']=$this->commission_types;
	$return['become']=array('0'=>'无条件','1'=>'后台指定','2'=>'提交申请','3'=>'按条件');
	$return['level']=$this->level_types;
	$return['htmls']=$htmls;
	exi($return);
}


